# 全局日志模块
import logging


class logger:
    Logger = logging.getLogger("Main")

    handler1 = logging.StreamHandler()
    handler2 = logging.FileHandler(filename="lastest.log", encoding="utf-8", mode="w")

    Logger.setLevel(logging.DEBUG)
    handler1.setLevel(logging.INFO)
    handler2.setLevel(logging.NOTSET)

    formatter = logging.Formatter("[%(asctime)s] [%(levelname)s] [%(threadName)s] : %(message)s",
                                  datefmt="%Y-%m-%d %H:%M:%S")
    handler1.setFormatter(formatter)
    handler2.setFormatter(formatter)

    Logger.addHandler(handler1)
    Logger.addHandler(handler2)

